package com.ydd.controller.user;


import com.ydd.dto.YddUserLoginDTO;
import com.ydd.result.Result;
import com.ydd.service.FrontLoginservice;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;


@RestController
@RequestMapping("/home/index")
@Slf4j
@Api(tags = "基础模块相关接口")
public class FrontLoginController {

    @Autowired
    private FrontLoginservice frontLoginservice;
    /**
     * 用户登录
     * @param user
     * @return
     */

    @PostMapping("/login")
    @ApiModelProperty("登录接口")
    public Result login(@RequestBody YddUserLoginDTO user) {

        log.info("登录接口:{}", user);
        Map<String, String> token = frontLoginservice.login(user);
        return Result.success(token);
    }
}